FIND_PATH(LIBCDR_INCLUDE_DIR libcdr/libcdr.h)
FIND_LIBRARY(LIBCDR_LIBRARY NAMES libcdr libcdr-0.2)
FIND_LIBRARY(LIBCDR_WPD_LIBRARY NAMES libwpd libwpd-0.9)
FIND_LIBRARY(LIBCDR_WPD_STREAM_LIBRARY NAMES libwpd-stream libwpd-stream-0.9)
FIND_LIBRARY(LIBCDR_WPG_LIBRARY NAMES libwpg libwpg-0.2)
FIND_LIBRARY(LIBCDR_LCMS2_LIBRARY NAMES lcms2 lcms2_static)
FIND_LIBRARY(LIBCDR_ZLIB_LIBRARY zlib)

IF(LIBCDR_INCLUDE_DIR AND LIBCDR_LIBRARY)
    SET(EXTERNAL_INCLUDE_DIR ${LIBCDR_INCLUDE_DIR})
    SET(EXTERNAL_LIBRARIES
        ${LIBCDR_LIBRARY}
        ${LIBCDR_WPD_LIBRARY} ${LIBCDR_WPD_STREAM_LIBRARY}
        ${LIBCDR_WPG_LIBRARY} ${LIBCDR_LCMS2_LIBRARY}
        ${LIBCDR_ZLIB_LIBRARY}
    )
    
    SET(LIBRARY_NAME osgdb_cdr)
    SET(LIBRARY_FILES ReaderWriterCDR.cpp)
    START_LIBRARY()
ENDIF(LIBCDR_INCLUDE_DIR AND LIBCDR_LIBRARY)
